package item;

import attribute.*;

/**
 * @invar	A wall cannot stand on a position together with another item.
 * 			|( (this.getPosition().hasItemOfClass(Wall.class)) 
 * 			|	&& (this.getPosition().getListOfItemsOnPosition().size() == 1) )
 * 
 *
 */
/**
 * @author John Breyssem	1Ba Informatica		r0303394
 * 
 * @author Lars Feyaerts	1Ba Informatica		r0296831
 * 
 * @version	1.3
 *
 */
public class Wall extends Item{
	
	/**
	 * Initialise this new wall with given coordinates X and Y on the given board.
	 * 
	 * @param X
	 * 			The x coordinate of the position the wall must have.
	 * @param Y
	 * 			The y coordinate of the position the wall must have.
	 * @param board
	 * 			The board the position must be on.
	 * 
	 * @effect	The position and board of the wall is set using setValidPosition(X, Y, board)
	 * 			| this.new.getPosition() = this.setValidPosition()
	 */
	public Wall(long X, long Y, Board board){
		this.setValidPosition(X, Y, board);
	}
	/**
	 * Initialise this new wall as a wall with board and coordinate are null, 
	 * 		isOnABoard and isTerminated are false.
	 */
	public Wall(){
	}
	

	/**
	 * This method returns whether or not this item can be put at the given position on the given board.
	 * 
	 * @return ...
	 * 			|if(p == null) then
	 * 			| 	result == true
	 *			...
	 *			|result == false;
	 */
	@Override
	public boolean canPutItemAt(Position p) {
		if(p == null)
			return true;
		else
			return false;
	}
	
	
	/**
	 * Nothing happens when a wall is hit by a laser.
	 */
	@Override
	public void hitByLaser() {
		return;
	}
	
	@Override
	public boolean hasAtleast(Object condition) {
		if(condition.getClass() == Position.class)
			if(this.getPosition() == (Position)condition)
				return true;
		return false;
	}	
}